package com.loopy.servlet.annotation;

import javax.servlet.*;
import javax.servlet.http.*;
import javax.servlet.annotation.*;
import java.io.IOException;

@WebServlet(name = "PigServlet", value = {"/pig1","/pig2"})
public class PigServlet extends HttpServlet {
    private int getCount=0;
    private int postCount=0;
    @Override
    protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
        System.out.println("PigServlet 请求方式是GET 请求次数是"+(++getCount)+"浏览器地址是"+request.getRemoteAddr());
    }

    @Override
    protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
        System.out.println("PigServlet 请求方式是POST 请求次数是"+(++postCount)+request.getRemoteHost());
    }
}
